import request from '@/utils/request'

// 查询房间列表
export function listHome(query) {
  return request({
    url: '/lock/home/list',
    method: 'get',
    params: query
  })
}
export function listHome2(query) {
  return request({
    url: '/lock/home/list2',
    method: 'get',
    params: query
  })
}

export function listHome3(query) {
  return request({
    url: '/lock/home/list3',
    method: 'get',
    params: query
  })
}

// 查询房间详细
export function getHome(id) {
  return request({
    url: '/lock/home/' + id,
    method: 'get'
  })
}

// 新增房间
export function addHome(data) {
  return request({
    url: '/lock/home',
    method: 'post',
    data: data
  })
}

// 修改房间
export function updateHome(data) {
  return request({
    url: '/lock/home',
    method: 'put',
    data: data
  })
}

// 删除房间
export function delHome(id) {
  return request({
    url: '/lock/home/' + id,
    method: 'delete'
  })
}

// 根据用户ID查询用户入住的房间列表
export function getHomeListByUserId(userId) {
  return request({
    url: `/lock/home/listByUserId/${userId}`,
    method: 'get'
  })
}

// 查询用户未入住的房间列表（过滤掉已入住的房间）
export function getHomeListByUserIdruzhu(query) {
  return request({
    url: '/lock/home/listByUserIdruzhu',
    method: 'get',
    params: query
  })
}
